var codeDom;
$(function () {
    codeDom = $('#code');
    $('#ff').on('click',('.textbox-button'),function () {  //textBox按钮点击事件
        // window.webkit.messageHandlers.openScanf.postMessage(null);
        window.top.openScan();
    });
    $('#save').click(function () {
        var code = codeDom.textbox('getValue');
        if(code == ''){
            $.messager.alert('错误','状态码不能为空','error');
            return false;
        }
        $.ajax({
            url:baseUrl+'mobile/shortcut/returnTabData',
            data:{code:code},
            type:'post',
            success:function (data) {
                $.messager.alert('成功',data,'info');
            },
            error:function (data) {
                $.messager.alert('错误',data['responseText'],'error');
            }
        });
    });
});


/**
 * 扫码回调
 * @type {{setResult: JSObjectHandle.setResult}}
 * created by dale 2017/9/15
 */
var JSObjectHandle = {
    setResult : function (code) {
        setTimeout(function () {
            codeDom.textbox('setValue',code);
        },0);

    }
}
